<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/restricted/template.xhtml">

        <ui:define name="title">MeteoCal - Search Friends</ui:define>
        <ui:define name="titlePag">search friends</ui:define>
        <ui:define name="content">
            <div class="event">
                <h:form>
                    <h:panelGrid columns="2" styleClass="eventoForm">
                        <p:inputText styleClass="eventInput" size="55" id="name"
                                     value="#{searchBean.name}" required="true" placeholder="Name Surname" 
                                     label="Name Surname"/>

                        <h:commandButton styleClass="searchButton" value="Search"  action="#{searchBean.search()}"  />
                        <p:message for="name" />
                    </h:panelGrid>
                </h:form>
            </div>  

            <ui:repeat var="amici" value="#{searchBean.possibleFriends}" varStatus="status" 
                       rendered="#{not searchBean.possibleFriends.isEmpty()}">

                <div class="searchPar">
                    <div class="eventoForm">
                       
                        <h:form>  
                            <p:commandLink action="#{searchBean.whereToGo()}" > 
                                <f:setPropertyActionListener target="#{searchBean.amicoSelected}" value="#{amici}"/>
                                #{amici.name} #{amici.surname} 
                                <p id="nickname">#{amici.nickname}</p>
                                <f:param name="userID" value="#{amici.nickname}" />
                            </p:commandLink>
                        
                        </h:form>

                    </div></div>
            </ui:repeat>


        </ui:define>

    </ui:composition>
</html>
